﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DTO;

namespace DAO
{
    public class LoaiNLG_DAO
    {
        private DataProvider _provider = new DataProvider();

        public LoaiNLG_DAO()
        {
            _provider.connect();
        }
        public DataTable GetTableLoaiNLG()
        {
            string s = "Select * from LoaiNLG";
            return _provider.executeQuery(s);
        }

        public void ThemLoaiNLG(LoaiNLG_DTO LNLG)
        {
            string s = "INSERT INTO LoaiNLG(MaLoaiNLG,TenLoaiNLG,DVT,DacDiem)VALUES('" + LNLG.MaLoaiNLG + "',N'" + LNLG.TenLoaiNLG 
                                                                           + "',N'" + LNLG.DVT + "',N'" + LNLG.DacDiem + "')";
            _provider.executeNonQuey(s);
        }
        public void XoaLoaiNLG(string MaLNLG)
        {
            string s = "DELETE FROM LoaiNLG WHERE MaLoaiNLG='" + MaLNLG + "'"  ;
            _provider.executeNonQuey(s);
        }
        public void SuaLoaiNLG(string MaLNLG, string TenLNLG, string DVT, string DacDiem)
        {
            string s = "UPDATE LoaiNLG SET TenLoaiNLG=N'" + TenLNLG
                       + "',DVT = N'" + DVT
                       + "',DacDiem = N'" + DacDiem
                       + "'WHERE MaLoaiNLG='" + MaLNLG + "'";
            _provider.executeNonQuey(s);

        }
    }
}
